package cn.bulibuqi.myblog.config;

import cn.bulibuqi.myblog.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author bulibuqi
 * @create 2021-12-21:22
 */
@Configuration
public class AdminWebConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginInterceptor())
            .addPathPatterns("/admin/**")  //要拦截的
                .excludePathPatterns("/admin","/admin/login");  //要放行的
    }
}
